package com.enation.app.shop.front.policyInsurance.adminController;

import com.enation.app.base.core.model.Member;
import com.enation.app.base.core.service.IMemberManager;
import com.enation.app.shop.core.goods.service.IGoodsManager;
import com.enation.app.shop.front.api.inpolicy.entity.InPolicy;
import com.enation.app.shop.front.api.inpolicy.service.IInpolicyManager;
import com.enation.app.shop.front.policyInsurance.adminController.FileEnum.ClaimStatus;
import com.enation.app.shop.front.policyInsurance.adminController.FileEnum.Type1;
import com.enation.app.shop.front.policyInsurance.adminController.FileEnum.Type2;
import com.enation.app.shop.front.policyInsurance.entity.*;
import com.enation.app.shop.front.policyInsurance.entity.img.*;
import com.enation.app.shop.front.policyInsurance.service.*;
import com.enation.framework.action.JsonResult;
import com.enation.framework.database.IDaoSupport;
import com.enation.framework.util.DateUtil;
import com.enation.framework.util.JsonResultUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.sql.Timestamp;
import java.util.*;

/**
 *政策保险理赔申请
 *
 */
@Scope("prototype")
@Controller
@RequestMapping("/app/claimApply")
public class ClaimController {

    @Autowired
    private ClaimApplicationMapper claimApplicationMapper;
    @Autowired
    private IInpolicyManager inpolicyManager;
    @Autowired
    private IMemberManager memberManager;
    @Autowired
    private IDaoSupport daoSupport;
    @Autowired
    private ClaimLossMapper claimLossMapper;
    @Autowired
    private InsuranceFileMapper insuranceFileMapper;
    @Autowired
    private HarmLessConductMapper harmLessConductMapper;
    @Autowired
    private ClaimResultMapper claimResultMapper;
    @Autowired
    private IEarMarkMapper earMarkMapper;
    @Autowired
    private IGoodsManager goodsManager;
    @Autowired
    private InsuranceBankCardMapper insuranceBankCardMapper;

    private Logger logger = Logger.getLogger(getClass());


    /**
     * 添加理赔时的判断
     * @param userid
     * @return
     */
    @ResponseBody
    @RequestMapping("confirmInPolicy")
    public JsonResult confirmInPolicy(Integer userid){
        List<InPolicy> inPolicies=inpolicyManager.getWarrantyByuserid(userid);
        if (inPolicies.size()==0){
            return JsonResultUtil.getErrorJson("请先投保");
        }
        Boolean flag=true;
        for (InPolicy inPolicy:inPolicies){
            if (inPolicy.getStatus()!=6){//保单状态为6是已承保
                flag=false;
                continue;
            }else {
                flag=true;
                break;
            }
        }
        if (flag){
            return JsonResultUtil.getSuccessJson("有已承保的保单");
        }else {
            return JsonResultUtil.getErrorJson("没有已承保的保单");
        }

    }

    /**
     *获取该用户已经投保的保险标的列表
     * @param userid
     * @return
     */
    @ResponseBody
    @RequestMapping("/getItemByUser")
    public JsonResult getItemByUser(Integer userid){

        List list=new ArrayList();
        List<InPolicy> inPolicies=inpolicyManager.getWarrantyByuseridAndStatus(userid,6);//保单状态为6是已承保
        if (inPolicies.size()==0){
            return JsonResultUtil.getErrorJson("您还没有保单信息");
        }
        for (InPolicy inPolicy:inPolicies){
            Map map=new HashMap();
            map.put("item",inPolicy.getItem());
            map.put("warrantyid",inPolicy.getWarranty_id());
            list.add(map);
        }
        return JsonResultUtil.getObjectMessageJson(list,"保险标的列表");
    }


    /**
     * app选择保险标的，得到保单信息（理赔时）
     * @param warrantyid
     * @return
     */
    @ResponseBody
    @RequestMapping("getInpolicyInfoByid")
    public JsonResult getInpolicyInfoByItem(Integer warrantyid){
        InPolicy inPolicy=inpolicyManager.getById(warrantyid);
        Map map=new HashMap();
        map.put("formal_number",inPolicy.getFormal_number());
        map.put("case_date",inPolicy.getCase_date().getTime());
        map.put("breed_factory_name",inPolicy.getInsurant_name());
        map.put("address",inPolicy.getInsuranced_address());
        map.put("receiver_id",inPolicy.getReceiver_id());
        map.put("receiver_name",inPolicy.getReceiver_name());
        return JsonResultUtil.getObjectMessageJson(map,"app选择保险标的，得到保单信息（理赔时）");
    }

    /**
     * 创建理赔申请单
     * @return
     */
    @Transactional
    @ResponseBody
    @RequestMapping("/addclaimapplication")
    public JsonResult add(@RequestBody ClaimApplication claimApplication){
        Long warrantyid=claimApplication.getWarranty_id();
        InPolicy inPolicy=inpolicyManager.getById(warrantyid.intValue());
        List<ClaimApplication> list=claimApplicationMapper.getByWarrantyid(warrantyid.intValue());
        if (list.size()>0){
            int total=0;
            for (ClaimApplication claimApplication2:list){
                total+=claimApplication2.getAmount();
            }
            if (total+claimApplication.getAmount()>inPolicy.getInsured_quantity()){
                return JsonResultUtil.getErrorJson("报案数量大于参保数量");
            }
        }
        ClaimApplication claimApplication1=new ClaimApplication();
        Member member=memberManager.getapp(claimApplication.getUserid());
        int claimcount=claimApplicationMapper.getClaimCount(claimApplication.getBreed_factory_id());//理赔次数
        claimApplication1.setItem(claimApplication.getItem());//item
        claimApplication1.setClaim_number(createSn());
        claimApplication1.setAmount(claimApplication.getAmount());//amount
        claimApplication1.setWarranty_id(claimApplication.getWarranty_id());
        claimApplication1.setFromal_number(claimApplication.getFromal_number());
        claimApplication1.setCase_date(claimApplication.getCase_date());
        claimApplication1.setAddress(claimApplication.getAddress());
      //  claimApplication1.setBreed_factory_id(claimApplication.getBreed_factory_id());
        claimApplication1.setBreed_factory_name(claimApplication.getBreed_factory_name());
        claimApplication1.setAddress(claimApplication.getAddress());
        claimApplication1.setApplication_people_id(claimApplication.getUserid());
        claimApplication1.setBreed_factory_id(claimApplication.getUserid().longValue());
        claimApplication1.setApplication_people_name(member.getName());
        claimApplication1.setApplication_date(new Timestamp(System.currentTimeMillis()));
        List<ClaimResult> claimResults=claimResultMapper.getByuserid(claimApplication.getUserid());
        claimApplication1.setClaims_count(claimResults.size());
        Double money = 0.00;
        if (claimResults.size() != 0) {
            for (ClaimResult claimResult : claimResults) {
                money += claimResult.getPay_money();
            }
        }
        claimApplication1.setClaims_money(money);
        claimApplication1.setReceiver_id((long)inPolicy.getReceiver_id());
        claimApplication1.setReceiver_name(inPolicy.getReceiver_name());
        claimApplication1.setCheck_status(ClaimStatus.Commited.value());
        claimApplication1.setUserid(claimApplication.getUserid());
        claimApplication1.setPhone(member.getMobile());
        try {
            int i=claimApplicationMapper.insert(claimApplication1);
            List<EarMark> earMarks=claimApplication.getEarMarks();
            for (EarMark earMark:earMarks){
                EarMark earMark1=new EarMark();
                earMark1.setEarmark(earMark.getEarmark());
                earMark1.setClaim_id(i);
                earMarkMapper.insert(earMark1);
            }
//            //图片
            List<DeadPig> deadPigs=claimApplication.getDeadPigimgurl();
            if (deadPigs!=null){
                for (DeadPig deadPig:deadPigs){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.Claimreported.value());
                    insuranceFile.setType2(Type2.DeadPig.value());
                    insuranceFile.setType3(deadPig.getType3());
                    insuranceFile.setUrl(deadPig.getUrl());
                    insuranceFile.setInstruction("理赔报案死亡猪照片");
                    insuranceFile.setRelevance_id((long)i);
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            List<Eartag> Eartags=claimApplication.getEartagimgurl();
            if (Eartags!=null){
                for (Eartag eartag:Eartags){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.Claimreported.value());
                    insuranceFile.setType2(Type2.Earmark.value());
                    insuranceFile.setType3(eartag.getType3());
                    insuranceFile.setUrl(eartag.getUrl());
                    insuranceFile.setInstruction("理赔报案耳标照片");
                    insuranceFile.setRelevance_id((long)i);
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            return JsonResultUtil.getSuccessJson("创建理赔申请成功");
        }catch (Exception e){
            return JsonResultUtil.getErrorJson("创建理赔申请失败");
        }
    };

    /**
     * 养殖端创建定损拍照,无害化接口，即现场查勘接口
     //* @param claimLoss
     * @return
     */
    @Transactional
    @ResponseBody
    @RequestMapping("/claimlossphoto")
    public JsonResult claimlossphoto(@RequestBody  ClaimLoss claimLoss){
        for (ClaimLossMin claimLossMin:claimLoss.getClaimLossMins()){
            ClaimLoss  claimLoss1=new ClaimLoss();
            claimLoss1.setEpidemic_prevention_code(claimLossMin.getEpidemic_prevention_code());
            claimLoss1.setAge(claimLossMin.getAge());
            claimLoss1.setWeight(claimLossMin.getWeight());
            claimLoss1.setLength(claimLossMin.getLength());
            claimLoss1.setUnit_money(claimLossMin.getUnit_money());
            claimLoss1.setNotes(claimLossMin.getNotes());
            claimLoss1.setSign_description(claimLoss.getSign_description());
            claimLoss1.setImmune(claimLoss.getImmune());
            claimLoss1.setDeath_cause(claimLoss.getDeath_cause());
            claimLoss1.setProspect_date(new Timestamp(System.currentTimeMillis()));
            Long claimid=claimLoss.getClaims_settlement_id();
            claimLoss1.setClaims_settlement_id(claimLoss.getClaims_settlement_id());
            claimLoss1.setHarmLessType(claimLoss.getHarmLessType());//无害化类型1：焚烧 2：深埋 3：化学池 4：其他
            HarmLessConduct harmLessConduct=new HarmLessConduct();
            harmLessConduct.setType(claimLoss.getHarmLessType());
            harmLessConduct.setDate(new Timestamp(System.currentTimeMillis()));
            harmLessConduct.setClaims_settlement_id(claimLoss.getClaims_settlement_id());
            harmLessConductMapper.insert(harmLessConduct);
            claimLossMapper.insert(claimLoss1);
        }
        try {

            Long claimid=claimLoss.getClaims_settlement_id();
            if (claimLoss.getBreedFactoryimgs()!=null){
                for (BreedFactoryimg BreedFactoryimg:claimLoss.getBreedFactoryimgs()){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.ClaimLoss.value());
                    insuranceFile.setType2(Type2.BreedFactory.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("养殖场全景照片");
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            if (claimLoss.getGenitalurl()!=null){
                for (Genitals BreedFactoryimg:claimLoss.getGenitalurl()){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.ClaimLoss.value());
                    insuranceFile.setType2(Type2.Genitals.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("生殖器照照片");
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            if (claimLoss.getEarMarkurl()!=null){
                for (EarMark BreedFactoryimg:claimLoss.getEarMarkurl()){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.ClaimLoss.value());
                    insuranceFile.setType2(Type2.Earmark.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("耳标特写照片");
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            if (claimLoss.getHeadcutearurl()!=null){
                for (Headcutear BreedFactoryimg:claimLoss.getHeadcutearurl()){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.ClaimLoss.value());
                    insuranceFile.setType2(Type2.Headcutear.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("头部割耳照片");
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            if (claimLoss.getHarmLessEarthshelteredurl()!=null){
                for (HarmLessEarthsheltered BreedFactoryimg:claimLoss.getHarmLessEarthshelteredurl()){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.HarmLess.value());
                    insuranceFile.setType2(Type2.HarmLessEarthsheltered.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("无害化处理过程(掩土)照片");
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            if (claimLoss.getHarmLessOverurl()!=null){
                for (HarmLessOver BreedFactoryimg:claimLoss.getHarmLessOverurl()){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.HarmLess.value());
                    insuranceFile.setType2(Type2.HarmLessOver.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setInstruction("无害化处理过程(完成)照片");
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            if (claimLoss.getRepersonnelurl()!=null){
                for (Repersonnel BreedFactoryimg:claimLoss.getRepersonnelurl()){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.HarmLess.value());
                    insuranceFile.setType2(Type2.Repersonnel.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("勘查人员现场照片");
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            if (claimLoss.getOtherurl()!=null){
                for (Other BreedFactoryimg:claimLoss.getOtherurl()){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.HarmLess.value());
                    insuranceFile.setType2(Type2.Other.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("其他照片");
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            return JsonResultUtil.getSuccessJson("创建定损拍照成功");
        }catch (Exception e){
            logger.error("创建定损拍照失败");
            return JsonResultUtil.getErrorJson("创建定损拍照失败");
        }
    }


    /**
     * 保险端现场查勘我要编辑保存接口
     * @param claimLoss
     * @return
     */
    @Transactional
    @ResponseBody
    @RequestMapping("/claimlossSitesurveyedit")
    public JsonResult claimlossSitesurveyedit(@RequestBody  ClaimLoss claimLoss) {
        Long claimid=claimLoss.getClaims_settlement_id();
        List<ClaimLoss> claimLosses=claimLossMapper.getByClaimid(claimid);
        for (ClaimLoss claimLoss1:claimLosses){
            claimLossMapper.deleteByPrimaryKey(claimLoss1.getId());
        }
        for (ClaimLossMin claimLossMin : claimLoss.getClaimLossMins()) {
            ClaimLoss claimLoss1 = new ClaimLoss();
            claimLoss1.setEpidemic_prevention_code(claimLossMin.getEpidemic_prevention_code());
            claimLoss1.setAge(claimLossMin.getAge());
            claimLoss1.setWeight(claimLossMin.getWeight());
            claimLoss1.setLength(claimLossMin.getLength());
            claimLoss1.setUnit_money(claimLossMin.getUnit_money());
            claimLoss1.setNotes(claimLossMin.getNotes());
            claimLoss1.setSign_description(claimLoss.getSign_description());
            claimLoss1.setImmune(claimLoss.getImmune());
            claimLoss1.setDeath_cause(claimLoss.getDeath_cause());
            claimLoss1.setProspect_date(new Timestamp(System.currentTimeMillis()));
            claimLoss1.setClaims_settlement_id(claimLoss.getClaims_settlement_id());
            claimLossMapper.insert(claimLoss1);
        }
        List<InsuranceFile> insuranceFiles=insuranceFileMapper.getBytype(Type1.ClaimLoss.value(),null,claimid.intValue());
        if (insuranceFiles!=null){
            for (InsuranceFile insuranceFile:insuranceFiles){
                insuranceFileMapper.deleteByPrimaryKey(insuranceFile.getId());
            }
        }
        try {
            if (claimLoss.getBreedFactoryimgs()!=null){
                for (BreedFactoryimg BreedFactoryimg:claimLoss.getBreedFactoryimgs()){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.ClaimLoss.value());
                    insuranceFile.setType2(Type2.BreedFactory.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("养殖场全景照片");
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            if (claimLoss.getGenitalurl()!=null){
                for (Genitals BreedFactoryimg:claimLoss.getGenitalurl()){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.ClaimLoss.value());
                    insuranceFile.setType2(Type2.Genitals.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("生殖器照照片");
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            if (claimLoss.getEarMarkurl()!=null){
                for (EarMark BreedFactoryimg:claimLoss.getEarMarkurl()){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.ClaimLoss.value());
                    insuranceFile.setType2(Type2.Earmark.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("耳标特写照片");
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            if (claimLoss.getHeadcutearurl()!=null){
                for (Headcutear BreedFactoryimg:claimLoss.getHeadcutearurl()){
                    InsuranceFile insuranceFile=new InsuranceFile();
                    insuranceFile.setType1(Type1.ClaimLoss.value());
                    insuranceFile.setType2(Type2.Headcutear.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("头部割耳照片");
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFile.setCreat_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            return JsonResultUtil.getSuccessJson("编辑成功");
        }catch (Exception e){
            logger.error("编辑失败");
            return JsonResultUtil.getSuccessJson("编辑失败");
        }
    }


    /**
     * 保险端编辑无害化
     * @param claimLoss
     * @return
     */
    @Transactional
    @ResponseBody
    @RequestMapping("/harmlessedit")
    public JsonResult HarmLessedit(@RequestBody  ClaimLoss claimLoss) {
        Integer harmtype=claimLoss.getHarmLessType();
        Long claimid = claimLoss.getClaims_settlement_id();
        List<ClaimLoss> claimLoss1=claimLossMapper.getByClaimid(claimid);
        List<HarmLessConduct> conducts=harmLessConductMapper.getByClaimid(claimid);
        for (HarmLessConduct harmLessConduct1:conducts){
            harmLessConductMapper.deleteByClaimid(claimid);
        }
        HarmLessConduct harmLessConduct=new HarmLessConduct();
        harmLessConduct.setType(claimLoss.getHarmLessType());
        harmLessConduct.setDate(new Timestamp(System.currentTimeMillis()));
        harmLessConduct.setClaims_settlement_id(claimLoss.getClaims_settlement_id());
        harmLessConductMapper.insert(harmLessConduct);
        for (ClaimLoss claimLoss2:claimLoss1){
            claimLoss2.setHarmLessType(harmtype);
            claimLossMapper.updateByPrimaryKey(claimLoss2);
        }
        List<InsuranceFile> insuranceFiles=insuranceFileMapper.getBytype(Type1.HarmLess.value(),null,claimid.intValue());
        if (insuranceFiles!=null){
            for (InsuranceFile insuranceFile:insuranceFiles){
                insuranceFileMapper.deleteByPrimaryKey(insuranceFile.getId());
            }
        }
        try {
            if (claimLoss.getHarmLessEarthshelteredurl() != null) {
                for (HarmLessEarthsheltered BreedFactoryimg : claimLoss.getHarmLessEarthshelteredurl()) {
                    InsuranceFile insuranceFile = new InsuranceFile();
                    insuranceFile.setType1(Type1.HarmLess.value());
                    insuranceFile.setType2(Type2.HarmLessEarthsheltered.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("无害化处理过程(掩土)照片");
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            if (claimLoss.getHarmLessOverurl() != null) {
                for (HarmLessOver BreedFactoryimg : claimLoss.getHarmLessOverurl()) {
                    InsuranceFile insuranceFile = new InsuranceFile();
                    insuranceFile.setType1(Type1.HarmLess.value());
                    insuranceFile.setType2(Type2.HarmLessOver.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("无害化处理过程(完成)照片");
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            if (claimLoss.getRepersonnelurl() != null) {
                for (Repersonnel BreedFactoryimg : claimLoss.getRepersonnelurl()) {
                    InsuranceFile insuranceFile = new InsuranceFile();
                    insuranceFile.setType1(Type1.HarmLess.value());
                    insuranceFile.setType2(Type2.Repersonnel.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("勘查人员现场照片");
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            if (claimLoss.getOtherurl() != null) {
                for (Other BreedFactoryimg : claimLoss.getOtherurl()) {
                    InsuranceFile insuranceFile = new InsuranceFile();
                    insuranceFile.setType1(Type1.HarmLess.value());
                    insuranceFile.setType2(Type2.Other.value());
                    insuranceFile.setType3(BreedFactoryimg.getType3());
                    insuranceFile.setUrl(BreedFactoryimg.getUrl());
                    insuranceFile.setInstruction("其他照片");
                    insuranceFile.setUpdate_at(new Timestamp(System.currentTimeMillis()));
                    insuranceFile.setRelevance_id(claimid);
                    insuranceFileMapper.insert(insuranceFile);
                }
            }
            return JsonResultUtil.getSuccessJson("保险端编辑无害化成功");
        }catch (Exception e){
            logger.error("保险端编辑无害化失败");
            return JsonResultUtil.getSuccessJson("保险端编辑无害化失败");
        }
    }



    /**
     * 养殖端创建定损拍照,无害化接口，即现场查勘接口
     //* @param claimLoss
     * @return
     */
    @Transactional
    @ResponseBody
    @RequestMapping("/claimlossphotoios")
    public JsonResult claimlossphotoios(HttpServletRequest request){
        String p=request.getParameter("claimLoss");
        JSONArray jsonArray=JSONArray.fromObject(p);
        for(int i=0 ; i <jsonArray.size() ;i++) {
            //获取每一个JsonObject对象
            JSONObject myjObject = jsonArray.getJSONObject(i);
            Map map=myjObject;
            String r=map.get("epidemic_prevention_code").toString();
        }
           // claimLossMapper.insert(claimLoss1);
        return JsonResultUtil.getSuccessJson("创建定损拍照成功");
    }
    /**
     * 理赔定损拍照，无害化上传图片接口
     * @return
     */
    @ResponseBody
    @RequestMapping("photourl")
    public  JsonResult claimPhoto(@RequestBody InsuranceFile insuranceFile){
        InsuranceFile insuranceFile1=new InsuranceFile();
        insuranceFile1.setType1(insuranceFile.getType1());
        insuranceFile1.setType2(insuranceFile.getType2());
        insuranceFile1.setType3(insuranceFile.getType3());
        insuranceFile1.setUrl(insuranceFile.getUrl());
        insuranceFile1.setRelevance_id(insuranceFile.getRelevance_id());
        insuranceFile1.setInstruction(insuranceFile.getInstruction());
        insuranceFile1.setCreat_at(new Timestamp(System.currentTimeMillis()));
        insuranceFile1.setUpdate_at(new Timestamp(System.currentTimeMillis()));
        try {
            insuranceFileMapper.insert(insuranceFile1);
            return JsonResultUtil.getSuccessJson("上传成功");
        }catch (Exception e){
            logger.error("上传失败");
            return JsonResultUtil.getErrorJson("上传失败");
        }
    }


//    /**
//     * 养殖端创建无害化
//     * @return
//     */
//    @ResponseBody
//    @RequestMapping("createharmless")
//    public JsonResult harmLess(){
//        return JsonResultUtil.getSuccessJson("");
//    }





    /**
     * 理赔时得到案件基本信息接口
     * @param userid
     * @param
     * @param type 1:案件基本信息  2:现场查勘  3:无害化  4:理赔结果
     * @return
     */
    @ResponseBody
    @RequestMapping("/getClaimInfo")
    public JsonResult getClaimInfo(Integer userid,Integer claimid,Integer type){
//        List<InPolicy> inPolicyList=inpolicyManager.getWarrantyByuserid(userid);
//        if (inPolicyList.size()==0){
//            return JsonResultUtil.getErrorJson("请先购买保险");
//        }
        ClaimApplication claimApplication=claimApplicationMapper.selectByPrimaryKey(claimid.longValue());
        InPolicy inPolicy=inpolicyManager.getById(claimApplication.getWarranty_id().intValue());
        Map map=new HashMap();
        Map map10=new HashMap();
        if (type==1){
            map.put("application_people_id",claimApplication.getApplication_people_id());
            map.put("fromal_number",claimApplication.getFromal_number());
            map.put("claim_number",claimApplication.getClaim_number());
            map.put("breed_factory_name",claimApplication.getBreed_factory_name());//被保险人（养殖户）
            map.put("item",claimApplication.getItem());
            map.put("begin_time",inPolicy.getBegin_time().getTime());
            map.put("end_time",inPolicy.getEnd_time().getTime());
            map.put("case_date",claimApplication.getCase_date().getTime());
            map.put("address",claimApplication.getAddress());
            map.put("application_date",claimApplication.getApplication_date().getTime());
            map.put("application_people_name",claimApplication.getApplication_people_name());//报案人
            map.put("amount",claimApplication.getAmount());//理赔申请次数
            map.put("claims_money",claimApplication.getClaims_money());
            map.put("claims_count",claimApplication.getClaims_count());//
            if (claimApplication.getClaims_count()>5){
                map.put("isformal","不正常");
            }else {
                map.put("isformal","正常");
            }
            List<EarMark> earMarks=earMarkMapper.getByClaimid(claimid.longValue());
            List list50=new ArrayList();
            if (earMarks!=null){
                for (EarMark earMark:earMarks){
                    Map map50=new HashMap();
                    map50.put("earmark",earMark.getEarmark());
                    list50.add(map50);
                }
            }
            //死亡猪
            List<InsuranceFile> insuranceFiles5=insuranceFileMapper.getBytype(Type1.Claimreported.value(),Type2.DeadPig.value(),claimid.intValue());
            List list5=new ArrayList();
            if (insuranceFiles5!=null){
                for (InsuranceFile insuranceFile:insuranceFiles5){
                    Map map5=new HashMap();
                    map5.put("url",insuranceFile.getUrl());
                    map5.put("type3",insuranceFile.getType3());
                    list5.add(map5);
                }
            }
            //耳标特写照
            List<InsuranceFile> insuranceFiles6=insuranceFileMapper.getBytype(Type1.Claimreported.value(),Type2.Earmark.value(),claimid.intValue());
            List list6=new ArrayList();
            if (insuranceFiles6!=null){
                for (InsuranceFile insuranceFile:insuranceFiles6){
                    Map map6=new HashMap();
                    map6.put("url",insuranceFile.getUrl());
                    map6.put("type3",insuranceFile.getType3());
                    list6.add(map6);
                }
            }
            map10.put("claiminfo",map);
            map10.put("deadPig",list5);
            map10.put("earmarkurl",list6);
            map10.put("earmark",list50);
        }else if (type==2){
            List list=new ArrayList();
            List<ClaimLoss> claimLosss=claimLossMapper.getByClaimid(claimid.longValue());
            for (ClaimLoss claimLoss:claimLosss){
                Map map5=new HashMap();
                map.put("claimid",claimLoss.getId());
                map5.put("epidemic_prevention_code",claimLoss.getEpidemic_prevention_code());
                map5.put("age",claimLoss.getAge());
                map5.put("weight",claimLoss.getWeight());
                map5.put("length",claimLoss.getLength());
                map5.put("unit_money",claimLoss.getUnit_money());
                map5.put("notes",claimLoss.getNotes());
                map5.put("sign_description",claimLoss.getSign_description());
                map5.put("immune",claimLoss.getImmune());
                map5.put("death_cause",claimLoss.getDeath_cause());
                list.add(map5);
            }

            //养殖场全景
            List<InsuranceFile> insuranceFiles1=insuranceFileMapper.getBytype(Type1.ClaimLoss.value(),Type2.BreedFactory.value(),claimid.intValue());
            List list1=new ArrayList();
            if (insuranceFiles1!=null){
                for (InsuranceFile insuranceFile:insuranceFiles1){
                    Map map1=new HashMap();
                    map1.put("url",insuranceFile.getUrl());
                    map1.put("urlid",insuranceFile.getId());
                    map1.put("type3",insuranceFile.getType3());
                    list1.add(map1);
                }
            }
            //生殖器
            List<InsuranceFile> insuranceFiles2=insuranceFileMapper.getBytype(Type1.ClaimLoss.value(),Type2.Genitals.value(),claimid.intValue());
            List list2=new ArrayList();
            if (insuranceFiles2!=null){
                for (InsuranceFile insuranceFile:insuranceFiles2){
                    Map map2=new HashMap();
                    map2.put("url",insuranceFile.getUrl());
                    map2.put("urlid",insuranceFile.getId());
                    map2.put("type3",insuranceFile.getType3());
                    list2.add(map2);
                }
            }
            //耳标特写
            List<InsuranceFile> insuranceFiles3=insuranceFileMapper.getBytype(Type1.ClaimLoss.value(),Type2.Earmark.value(),claimid.intValue());
            List list3=new ArrayList();
            if (insuranceFiles3!=null){
                for (InsuranceFile insuranceFile:insuranceFiles3){
                    Map map3=new HashMap();
                    map3.put("url",insuranceFile.getUrl());
                    map3.put("urlid",insuranceFile.getId());
                    map3.put("type3",insuranceFile.getType3());
                    list3.add(map3);
                }
            }
            //头部割耳
            List<InsuranceFile> insuranceFiles4=insuranceFileMapper.getBytype(Type1.ClaimLoss.value(),Type2.Headcutear.value(),claimid.intValue());
            List list4=new ArrayList();
            if (insuranceFiles4!=null){
                for (InsuranceFile insuranceFile:insuranceFiles4){
                    Map map4=new HashMap();
                    map4.put("url",insuranceFile.getUrl());
                    map4.put("type3",insuranceFile.getType3());
                    map4.put("urlid",insuranceFile.getId());
                    list4.add(map4);
                }
            }
            map10.put("claimloss",list);
            map10.put("breedFactoryimg",list1);
            map10.put("genitals",list2);
            map10.put("earmarkimg",list3);
            map10.put("headcutear",list4);
        }else if (type==3){
            List<ClaimLoss> claimLosss=claimLossMapper.getByClaimid(claimid.longValue());
            List<HarmLessConduct> harmLessConducts=harmLessConductMapper.getByClaimid(claimid.longValue());
            for (HarmLessConduct claimLoss:harmLessConducts){
                map.put("harmlesstype",claimLoss.getType());//1：焚烧 2：深埋 3：化学池 4：其他
                map.put("claimid",claimLoss.getId());
            }

            //无害化处理过程(掩土)
            List<InsuranceFile> insuranceFiles7=insuranceFileMapper.getBytype(Type1.HarmLess.value(),Type2.HarmLessEarthsheltered.value(),claimid.intValue());
            List list7=new ArrayList();
            if (insuranceFiles7!=null){
                for (InsuranceFile insuranceFile:insuranceFiles7){
                    Map map7=new HashMap();
                    map7.put("url",insuranceFile.getUrl());
                    map7.put("urlid",insuranceFile.getId());
                    map7.put("type3",insuranceFile.getType3());
                    list7.add(map7);
                }
            }
            //无害化处理过程(完成)
            List<InsuranceFile> insuranceFiles8=insuranceFileMapper.getBytype(Type1.HarmLess.value(),Type2.HarmLessOver.value(),claimid.intValue());
            List list8=new ArrayList();
            if (insuranceFiles8!=null){
                for (InsuranceFile insuranceFile:insuranceFiles8){
                    Map map8=new HashMap();
                    map8.put("url",insuranceFile.getUrl());
                    map8.put("urlid",insuranceFile.getId());
                    map8.put("type3",insuranceFile.getType3());
                    list8.add(map8);
                }
            }
            //勘查人员现场照(完成)
            List<InsuranceFile> insuranceFiles9=insuranceFileMapper.getBytype(Type1.HarmLess.value(),Type2.Repersonnel.value(),claimid.intValue());
            List list9=new ArrayList();
            if (insuranceFiles9!=null){
                for (InsuranceFile insuranceFile:insuranceFiles9){
                    Map map9=new HashMap();
                    map9.put("url",insuranceFile.getUrl());
                    map9.put("type3",insuranceFile.getType3());
                    map9.put("urlid",insuranceFile.getId());
                    list9.add(map9);
                }
            }
            //其他相片
            List<InsuranceFile> insuranceFiles11=insuranceFileMapper.getBytype(Type1.HarmLess.value(),Type2.Other.value(),claimid.intValue());
            List list11=new ArrayList();
            if (insuranceFiles11!=null){
                for (InsuranceFile insuranceFile:insuranceFiles11){
                    Map map11=new HashMap();
                    map11.put("url",insuranceFile.getUrl());
                    map11.put("urlid",insuranceFile.getId());
                    map11.put("type3",insuranceFile.getType3());
                    list11.add(map11);
                }
            }
            map10.put("harmless",map);
            map10.put("harmLessEarthshelteredimg",list7);
            map10.put("harmLessoverimg",list8);
            map10.put("repersonnelimg",list9);
            map10.put("otherimg",list11);
        }else {
            ClaimResult claimResult=claimResultMapper.getByClaimid(claimid.longValue());

            if (claimResult.getStatus()==ClaimStatus.NotAgree.value()){
                map.put("surveySuggestion",claimResult.getSurveySuggestion());
            }else {
                map.put("surveySuggestion",claimResult.getSurveySuggestion());
                map.put("total",claimResult.getPay_money());
                map.put("bankcard",claimResult.getBank_card());
                map.put("bankusername",claimResult.getBank_user_name());
                map.put("openbank",claimResult.getOpening_bank());
                map.put("accounttype",claimResult.getAccount_type());
            }
            return JsonResultUtil.getObjectMessageJson(map,"理赔时得到案件基本信息接口");
        }
        return JsonResultUtil.getObjectMessageJson(map10,"理赔时得到案件基本信息接口");
    }


    /**
     * 理赔列表接口
     * @param userid
     * @param status
     * item根据保险标的模糊查询
     * @return
     */
    @ResponseBody
    @RequestMapping("/getClaimList")
    public JsonResult getClaimList(Integer userid,Integer status,String item){
        Member member=memberManager.getapp(userid);
        List<ClaimApplication> claimApplications=new ArrayList<ClaimApplication>();
        if (member.getMember_type()==1){
            claimApplications=claimApplicationMapper.listByUseridAndStatusFac(userid,status,item);
        }else {
           claimApplications=claimApplicationMapper.listByUseridAndStatusIns(userid,status,item);
        }
        List list=new ArrayList();
        for (ClaimApplication claimApplication:claimApplications){
            Map map=new HashMap();
            Integer warrantyid=claimApplication.getWarranty_id().intValue();
            InPolicy inPolicy=inpolicyManager.getById(warrantyid);
            map.put("item",claimApplication.getItem());
           // map.put("",claimApplication.getClaim_number());
            map.put("claim_number",claimApplication.getClaim_number());
            map.put("case_date",claimApplication.getCase_date().getTime());
            map.put("amount",claimApplication.getAmount());
            map.put("check_status",claimApplication.getCheck_status());
            map.put("phone",claimApplication.getPhone());
            map.put("address",claimApplication.getAddress());
            map.put("application_date",claimApplication.getApplication_date().getTime());
            map.put("breed_factory_name",claimApplication.getBreed_factory_name());
            map.put("receiver_name",claimApplication.getReceiver_name());
            map.put("claims_settlement_id",claimApplication.getId());
           // map.put("insured_quantity",inPolicy.getInsured_quantity());
            map.put("member_type",member.getMember_type());
            list.add(map);
        }

        return JsonResultUtil.getObjectMessageJson(list,"得到理赔列表接口");
    }







    /**
     * 创建理赔单号（日期+两位随机数）
     */
    private String createSn(){
        boolean isHave = true;  //数据库中是否存在该保单
        String sn = "";			//保单号

        //如果存在当前保单
        while(isHave) {
            StringBuffer  snSb = new StringBuffer("Claim2018") ;
            snSb.append(DateUtil.getDateline()+"");
            snSb.append(new Random().nextInt(100-10)+10);
            String sql = "SELECT count(*) FROM rbt_claim_application WHERE claim_number = '" + snSb.toString() + "'";
            int count = this.daoSupport.queryForInt(sql);
            if(count == 0) {
                sn = snSb.toString();
                isHave = false;
            }
        }
        return sn;
    }

    /**
     * 理赔拒绝接口
     * @param userid
     * @param claims_settlement_id
     * @param surveySuggestion
     * @return
     */
    @Transactional
    @ResponseBody
    @RequestMapping("/claimrefuse")
    public JsonResult claimresult(Integer userid,Integer claims_settlement_id,String surveySuggestion){
        ClaimResult claimResult=new ClaimResult();
        claimResult.setClaims_settlement_id(claims_settlement_id);
        claimResult.setDate(new Timestamp(System.currentTimeMillis()));
       // claimResult.setInsured_breed_id(userid);
        claimResult.setStatus(ClaimStatus.NotAgree.value());
        claimResult.setSurveySuggestion(surveySuggestion);
        ClaimApplication claimApplication=claimApplicationMapper.selectByPrimaryKey(claims_settlement_id.longValue());
        claimApplication.setCheck_status(ClaimStatus.NotAgree.value());
        claimApplicationMapper.updateByPrimaryKey(claimApplication);
        int i=claimResultMapper.insert(claimResult);
        if (i>0){
            return JsonResultUtil.getSuccessJson("理赔拒绝成功");
        }else {
            return JsonResultUtil.getErrorJson("理赔拒绝失败");
        }
    }


    /**
     *理赔同意
     * @return
     */
    @Transactional
    @ResponseBody
    @RequestMapping("/claimagree")
    public JsonResult claimagree(@RequestBody  ClaimResult claimResult){
        ClaimResult claimResult1=new ClaimResult();
        claimResult1.setDate(new Timestamp(System.currentTimeMillis()));
        claimResult1.setClaims_settlement_id(claimResult.getClaims_settlement_id());//claims_settlement_id
        claimResult1.setBank_card(claimResult.getBank_card());//bank_card
        claimResult1.setAccount_type(claimResult.getAccount_type());//account_type
        claimResult1.setStatus(ClaimStatus.Over.value());
        claimResult1.setSurveySuggestion(claimResult.getSurveySuggestion());//surveySuggestion
        claimResult1.setBank_user_name(claimResult.getBank_user_name());//bank_user_name
        claimResult1.setOpening_bank(claimResult.getOpening_bank());//opening_bank
        claimResult1.setPay_money(claimResult.getPay_money());//pay_money
        ClaimApplication claimApplication=claimApplicationMapper.selectByPrimaryKey(claimResult.getClaims_settlement_id().longValue());
        claimApplication.setCheck_status(ClaimStatus.Over.value());
        claimApplicationMapper.updateByPrimaryKey(claimApplication);
        int i=claimResultMapper.insert(claimResult1);
        if (i>0){
            return JsonResultUtil.getSuccessJson("理赔同意成功");
        }else {
            return JsonResultUtil.getErrorJson(" 理赔同意失败");
        }
    }






    /**
     * 理赔初审
     * @param claimid
     * @return
     */
    @ResponseBody
    @RequestMapping("claimfirstConfirm")
    public JsonResult claimfirstCofirm(Long claimid){
        ClaimApplication claimApplication=claimApplicationMapper.selectByPrimaryKey(claimid);
        if (claimApplication==null){
            return JsonResultUtil.getErrorJson("没有理赔信息");
        }else {
            claimApplication.setCheck_status(ClaimStatus.Site_survey.value());
            try {
                claimApplicationMapper.updateByPrimaryKey(claimApplication);
                return JsonResultUtil.getSuccessJson("理赔初审成功");
            }catch (Exception e){
                logger.error("理赔初审失败");
                return JsonResultUtil.getErrorJson("理赔初审失败");
            }

        }

    }




    /**
     * 得到该保单历史理赔信息
     * @param warrantyid
     * @return
     */
    @ResponseBody
    @RequestMapping("gethistoryclaim")
    public JsonResult getHistoryClaim(Integer warrantyid){
        List<ClaimApplication> claimApplications=claimApplicationMapper.getByWarrantyid(warrantyid);
        if (claimApplications==null){
            return JsonResultUtil.getErrorJson("该保单还没有历史索赔信息");
        }
        List list=new ArrayList();
        for (ClaimApplication claimApplication:claimApplications){
            Map map=new HashMap();
            map.put("amount",claimApplication.getAmount());
            map.put("claim_number",claimApplication.getClaim_number());
            map.put("application_date",claimApplication.getApplication_date());
            map.put("address",claimApplication.getAddress());
            map.put("phone",claimApplication.getPhone());
            list.add(map);
        }
        return JsonResultUtil.getObjectMessageJson(list,"得到该保单历史理赔信息");
    }


    /**
     * 点击理赔结果得到信息
     * @param claimid
     * @return
     */
    @ResponseBody
    @RequestMapping("/getClaimResultInfo")
    public JsonResult claimResultinfo(Long claimid){
        ClaimApplication claimApplication=claimApplicationMapper.selectByPrimaryKey(claimid);
        InPolicy inPolicy=inpolicyManager.getById(claimApplication.getWarranty_id().intValue());
        double price=goodsManager.getGoods(inPolicy.getGoods_id()).getPrice();
        int amount=claimApplication.getAmount();
        double total=price*amount;
        Long breedid=claimApplication.getBreed_factory_id();
        List<InsuranceBankCard>  insuranceBankCards=insuranceBankCardMapper.selectByUserId(breedid.intValue());
        Map map=new HashMap();
        if (insuranceBankCards!=null){
            for (InsuranceBankCard insuranceBankCard:insuranceBankCards){
                map.put("bankcard",insuranceBankCard.getBank_card());
                map.put("bankusername",insuranceBankCard.getBank_user_name());
                map.put("accounttype",insuranceBankCard.getAccount_type());
                map.put("openbank",insuranceBankCard.getOpening_bank());
            }
        }else {
            map.put("bankcard","");
            map.put("bankusername","");
            map.put("accounttype","");
            map.put("openbank","");
        }
        map.put("total",total);
        map.put("application_people_id",claimApplication.getApplication_people_id());
        return JsonResultUtil.getObjectMessageJson(map,"点击理赔结果得到信息");
    }

}
